package org.example.platform.session;

import org.example.platform.binding.MapperRegistry;

public class DefaultSqlSession implements SqlSeesion {

    /**
     * 映射器注册机
     */
    private MapperRegistry mapperRegistry;

    public DefaultSqlSession(MapperRegistry mapperRegistry) {
        this.mapperRegistry = mapperRegistry;
    }

    @Override
    public <T> T selectOne(String statement) {
        return null;
    }

    @Override
    public <T> T selectOne(String statement, Object parameter) {
        return (T) ("你被代理了！" + "方法：" + statement + " 入参：" + parameter);
    }

    @Override
    public <T> T getMapper(Class<T> type) throws Exception {
        return mapperRegistry.getMapper(type,this);
    }

    @Override
    public String get(String s) {
        return s;
    }

}
